#ifndef SPATIALOBJECTS_H
#define SPATIALOBJECTS_H

#include <QObject>
#define COORD_DIVIDER 600000.0 //经纬度需要除以60万才能得到真实值

class SpatialGrid;
class SpatialObjectBase
{
public:
    explicit SpatialObjectBase(quint64 objectID,double longit,double lat);
    virtual float distanceTo(SpatialObjectBase* sOB)=0;
    //将邻域内的对象列表合并到hashIDSPOBJ中
    QList <SpatialObjectBase*> getNeighborObjects(double eps);
    void expandCluster(SpatialObjectBase* coreObj,QHash <quint64,SpatialObjectBase*> &hashIDNeighborObjs,
                QList <SpatialObjectBase*> &cluster,QHash <quint64, SpatialObjectBase *> &hashIDIteratingSPOBJ,
                       double eps,quint32 minPts);
    static void mergeList2Hash(QList <SpatialObjectBase*> listSPOBJ,QHash <quint64,SpatialObjectBase*> &hashIDSPOBJ);

    void setDistance();//设置8个dist变量
    virtual ~SpatialObjectBase();

    quint64 getObjectID() const;
    void setObjectID(const qint32 &value);

    double getLongitude() const;
    void setLongitude(const double &value);

    double getLatitude() const;
    void setLatitude(const double &value);

    SpatialGrid *getSpatialGrid() const;
    void setSpatialGrid(SpatialGrid *value);

signals:

public slots:

private:
    quint64 objectID;
    double longitude;
    double latitude;
    SpatialGrid *spatialGrid;

    float dist2Top,dist2Right,dist2Bottom,dist2Left,
            dist2TopRight,dist2BottomRight,dist2BottomLeft,dist2TopLeft;
};

#endif // SPATIALOBJECTS_H
